# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=expect
pkgver=5.45.4
pkgrel=4
pkgdesc="A tool for automating interactive applications"
url="https://core.tcl-lang.org/expect/index"
arch="all"
# https://expect.sourceforge.net/FAQ.html#q6
license="NIST-PD"
makedepends="tcl-dev"
subpackages="$pkgname-dev $pkgname-doc"
source="https://downloads.sourceforge.net/project/expect/Expect/$pkgver/expect$pkgver.tar.gz
	07-file-handle.patch
	09-unsafe-traps.patch
	10-manpage.patch
	12-fdout.patch
	22-segfault-with-stubs.patch
	24-format.patch
"
builddir="$srcdir"/$pkgname$pkgver

prepare() {
	default_prepare
	update_config_sub
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--mandir=/usr/share/man \
		--with-tcl=/usr/lib \
		--with-tclinclude=/usr/include \
		--disable-rpath
	make
}

check() {
	make test
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
a8dc25e8175f67e029e15cbcfca1705165c1c4cb2dd37eaaaebffb61e3ba132d9519cd73ca5add4c3358a2b0b7a91e878279e8d0b72143ff2c287fce07e4659a  expect5.45.4.tar.gz
ccdff94648a732cfb12cb079e37449913579b536d43f46a1e95687c3be8d4ce84b01be6748b34b59a4b4bf1cbc755de96f8f7882d5bc5c9a704cb5ef3103836f  07-file-handle.patch
e8a3c4c6d634c135e1f3b7ccfb543281fdbaa83870670ff87bdd0aaf07c803f79353b512e49b311ecd8f701c9e2d0d3e2994a3d5b344cdd6f0220d92fc1cea7d  09-unsafe-traps.patch
f7760ba5ce60659cce4d64beaf3cf50ecd6a8af7714b704bbd08ba970e0883b0eb7ddfd83522f21bf1bbe86cdbe26d70d4517f9d58030128c2a311e6d18c6b30  10-manpage.patch
8675a93f3344e4eeb5024faa487bdcdfb0bc8ec86ed0abcf5612e130e346b35f7d9bf7d601714cc6acb32ccc77ecc309e51e39e0a0ad17f0a3ceeacc5031f6ce  12-fdout.patch
f4c7789feea3eae471c988d7c78ce78da1bd4ab765d142e7fce5a7a2a92e887310ba571ea2a010110f7e0859102fadfb56b2b7e1638c52586657299e6e332c91  22-segfault-with-stubs.patch
38b542330d26ca0dade87bfad20f71f7411fc2951d4d53706f938f83a862ed4868990bc24bdbffb09c9591cca22cca913e073605216311a36a008550c00b1b78  24-format.patch
"
